package ua.kpi.ustymenko.counter;

import ua.kpi.ustymenko.testcase.Answers;
import ua.kpi.ustymenko.testcase.question.Question;

public class SingleCounter implements AnswersScoreCounter {
    private static final double MAX_SCORE = 1.0;
    private static final double MIN_SCORE = 0.0;

    @Override
    public double countScore(Question question, Answers answers) {
        if (answers.size() != 1) {
            throw new IllegalArgumentException("Must be exactly 1 answer!");
        }
        if (question.getCorrectAnswers().equals(answers))
            return MAX_SCORE;
        return MIN_SCORE;
    }
}
